import { Controller } from "../../mvc/core/Controller";
import { DataEvent } from "../events/DataEvent";
import { GameProxy } from "../mvc/GameProxy";
import { SEntityId } from "../../../Message/Public/SEntityId";
import { IView } from "../../mvc/interfaces/IView";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { SGangFightsGetRooms } from "../../../Message/Public/SGangFightsGetRooms";
import { GangFightsRoomData } from "../view/gangFights/data/GangFightsRoomData";
import { GangFightsEnterWindow } from "../view/gangFights/GangFightsEnterWindow";
import { SGangFightsApplyTeam } from "../../../Message/Public/SGangFightsApplyTeam";
import { GangFightsApplyTeamIcon } from "../view/gangFights/GangFightsApplyTeamIcon";
import { UiHintIconView } from "../view/uiIconBtn/UiHintIconView";
import { SGangFightsBattles } from "../../../Message/Public/SGangFightsBattles";
import { GangFightsMainWindow } from "../view/gangFights/GangFightsMainWindow";
import { GangFightsOpenIcon } from "../view/gangFights/GangFightsOpenIcon";
import { SGangFightsGroup } from "../../../Message/Public/SGangFightsGroup";
import { SGangFightsInvitePlayer } from "../../../Message/Public/SGangFightsInvitePlayer";
import { GangFightsInviteTeamIcon } from "../view/gangFights/GangFightsInviteTeamIcon";
import { SGangFightsMatch } from "../../../Message/Public/SGangFightsMatch";
import { Global } from "../../../com/gengine/global/Global";
import { Alert } from "../../../com/mui/controls/Alert";
import { TimerAlertWin } from "../view/common/alertwins/TimerAlertWin";
import { Language } from "../../../extend/language/Language";
import { GangFightsReadyTimeView } from "../view/gangFights/GangFightsReadyTimeView";
import { GangFightsWaitingTimeView } from "../view/gangFights/GangFightsWaitingTimeView";
import { EntityUtil } from "../scene/layer/utils/EntityUtil";
import { CopyLeaveBtnView } from "../view/common/CopyLeaveBtnView";
import { LeftTimeView } from "../view/common/LeftTimeView";
import { ArenaGroupView } from "../view/arena/ArenaGroupView";
import { GangFightsAids } from "../view/gangFights/aids/GangFightsAids";
import { BrowerManager } from "../../../com/gengine/manager/BrowerManager";
import { SGangFightsMyInfo } from "../../../Message/Public/SGangFightsMyInfo";
import { GangFightsMeritWindow } from "../view/gangFights/GangFightsMeritWindow";
import { SGangFightsMyInfoEx } from "../../../Message/Public/SGangFightsMyInfoEx";
import { SGangFightsOpen } from "../../../Message/Public/SGangFightsOpen";
import { LevelLimitDefin } from "../../common/defin/LevelLimitDefin";
import { SGangFightsResult } from "../../../Message/Public/SGangFightsResult";
import { GangFightsResultWindow } from "../view/gangFights/GangFightsResultWindow";
import { GameController } from "../mvc/GameController";
import { SGangFightsSignUp } from "../../../Message/Public/SGangFightsSignUp";
import { SGangFightsStart } from "../../../Message/Public/SGangFightsStart";
import { MsgManager } from "../manager/MsgManager";
import { SGangFightsTeamInfo } from "../../../Message/Public/SGangFightsTeamInfo";
import { GangFightsTeamMsgWindow } from "../view/gangFights/GangFightsTeamMsgWindow";
import { SGangFightsToplist } from "../../../Message/Public/SGangFightsToplist";
import { SGangFightsAccount } from "../../../Message/Public/SGangFightsAccount";
import { SLookupPlayerReply } from "../../../Message/Game/SLookupPlayerReply";
import { GangFightsCreateTeamWindow } from "../view/gangFights/GangFightsCreateTeamWindow";
import { GameMapUtil } from "../scene/map/GameMapUtil";
import { LayerManager } from "../manager/LayerManager";
import { GangFightsGetTopListdata } from "../view/gangFights/data/GangFightsGetTopListdata";
import { GangfightsCreateTeamData } from "../view/gangFights/data/GangfightsCreateTeamData";
import { GangFightsReplyData } from "../view/gangFights/data/GangFightsReplyData";
import { EGangFightsTeamPos } from "../../../Message/Public/EGangFightsTeamPos";
type int = number;
//class GangFightsController
    
    export  class GangFightsController extends Controller
    {
        constructor()
        {
            
            super();this._aryRequestPlayerMsg = [];
            return;
        }

        /* internal  */onIsAccept(arg1: DataEvent): void
        {
            var loc1=Boolean(arg1.data);
            if (loc1) 
            {
                GameProxy.gangFights.enterGangFights(false, 0);
            }
            return;
        }

        /* internal  */onGetPlayerMsg(arg1: DataEvent): void
        {
            var loc1=arg1.data as SEntityId;
            this._aryRequestPlayerMsg.push(loc1);
            GameProxy.playerInfoProxy.lookupRequest_async(cache.role.entityInfo.entityId, loc1, this.onPlayerNotOnLine, false, false);
            return;
        }

        protected /* override */ initView(): IView
        {
            return super.initView();
        }

        protected /* override */ initServer(): void
        {
            NetDispatcher.addCmdListener(ServerCommand.GangFightsRoomListCommand, this.onRoomListCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightApplyTeamCommand, this.onApplyTeamCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightBattlesCommand, this.onBattlesCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightCloseCommand, this.onCloseCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightGroupCommand, this.onGroupCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightInvitePlayerCommand, this.onInvitePlayerCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightMatchCommand, this.onMatchCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightMyInfoCommand, this.onMyInfoCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightMyInfoExCommand, this.onMyInfoExCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightOpenCommand, this.onOpenCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightResultCommand, this.onResultCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightSignUpCommand, this.onSignUpCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightStartCommand, this.onStartCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightTeamInfoCommand, this.onTeamInfoCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightTopListCommand, this.onTopListCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightWillOpenCommand, this.onWillOpenCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightMagicStoneCommand, this.onMagicStoneCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightMeritCommand, this.onMeritCommand);
            NetDispatcher.addCmdListener(ServerCommand.GangfightAccoutCommand, this.onAccountCommand);
            NetDispatcher.addCmdListener(ServerCommand.PlayerInfoReply, this.onPlayerInfoCommand);
            NetDispatcher.addCmdListener(ServerCommand.RoleLevelUpdate, this.onRoleLevelUpdate);
            NetDispatcher.addCmdListener(ServerCommand.GangfightCreateTeamSuccess, this.onCreateTeamSuccess);
            NetDispatcher.addCmdListener(ServerCommand.GangfightModifyTeamSuccess, this.onModifyTeamSuccess);
            NetDispatcher.addCmdListener(ServerCommand.GangFightsDieCommand, this.onGangFightsDieCommand);
            Dispatcher.addEventListener(EventName.GangFightsGetRoomList, this.onGetRoomList);
            Dispatcher.addEventListener(EventName.GangFightsShowGangFightsEnterWindow, this.onShowGangFightsEnterWindow);
            Dispatcher.addEventListener(EventName.GangFightsRequestEnterWaitingRoom, this.onRequestEnterWaitingRoom);
            Dispatcher.addEventListener(EventName.GangFightsShowMainWindow, this.onShowMainWindow);
            Dispatcher.addEventListener(EventName.GangFightsGetMyInfo, this.onGetMyInfo);
            Dispatcher.addEventListener(EventName.GangFightsGetBattles, this.onGetBattles);
            Dispatcher.addEventListener(EventName.GangFightsLookBattle, this.onGangFightsLookBattle);
            Dispatcher.addEventListener(EventName.GangFightsJoin, this.onGangFightsJoin);
            Dispatcher.addEventListener(EventName.GangFightsCancelJoin, this.onGangFightsCancelJoin);
            Dispatcher.addEventListener(EventName.Scene_Update, this.onSceneUpdate);
            Dispatcher.addEventListener(EventName.GangFightExit, this.onGangFightExit);
            Dispatcher.addEventListener(EventName.GangFightExitNow, this.onGangFightExitNow);
            Dispatcher.addEventListener(EventName.GangFightsChangeToTab, this.onGangFightsChangeToTab);
            Dispatcher.addEventListener(EventName.GangFightsShowCreateTeamWindow, this.onGangFightsShowCreateTeamWindow);
            Dispatcher.addEventListener(EventName.GangFightsGetTopList, this.onGetTopList);
            Dispatcher.addEventListener(EventName.GangFightsApplyTeam, this.onApplyTeam);
            Dispatcher.addEventListener(EventName.GangFightsCreateTeam, this.onCreateTeam);
            Dispatcher.addEventListener(EventName.GangFightsReplyApply, this.onGangFightsReplyApply);
            Dispatcher.addEventListener(EventName.GangFightsGetTeamInfo, this.onGetTeamInfo);
            Dispatcher.addEventListener(EventName.GangFightsGetTeamOtherInfo, this.onGetTeamOtherInfo);
            Dispatcher.addEventListener(EventName.GangFightsModifyTeam, this.onGangFightsModifyTeam);
            Dispatcher.addEventListener(EventName.GangFightsChangeCaptain, this.onChangeCaptain);
            Dispatcher.addEventListener(EventName.GangFightsKickOut, this.onKickOut);
            Dispatcher.addEventListener(EventName.GangFightsDisbandTeam, this.onDisbandTeam);
            Dispatcher.addEventListener(EventName.GangFightsLeaveTeam, this.onLeaveTeam);
            Dispatcher.addEventListener(EventName.GangFightsInviteFriend, this.onInviteFriend);
            Dispatcher.addEventListener(EventName.GangFightsReplyInvite, this.onReplyInvite);
            Dispatcher.addEventListener(EventName.GangFightsIsAccept, this.onIsAccept);
            Dispatcher.addEventListener(EventName.GangfightsGetPlayerMsg, this.onGetPlayerMsg);
            Dispatcher.addEventListener(EventName.GangFightsTipAddTeam, this.onTipAddTeam);
            return;
        }

        /* internal  */onTipAddTeam(arg1: DataEvent): void
        {
            this.tipAddTeam();
            return;
        }

        /* internal  */onRoomListCommand(arg1: SGangFightsGetRooms): void
        {
            var loc4=null;
            var loc5=null;
            var loc1=[];
            var loc2=0;
            var loc3=0;
            while (loc3 < arg1.rooms.length) 
            {
                if ((loc4 = arg1.rooms[loc3]).open) 
                {
                    (loc5 = new GangFightsRoomData()).index = ++loc2;
                    loc5.room = loc4;
                    loc5.teamMark = arg1.teamMark;
                    loc1.push(loc5);
                }
                ++loc3;
            }
            GangFightsEnterWindow.instance.updateList(loc1);
            return;
        }

        /* internal  */onApplyTeamCommand(arg1: SGangFightsApplyTeam): void
        {
            GangFightsApplyTeamIcon.instance.showIcon(arg1);
            UiHintIconView.instance.addHintIcon(GangFightsApplyTeamIcon.instance);
            return;
        }

        /* internal  */onBattlesCommand(arg1: SGangFightsBattles): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateBattles(arg1);
            }
            return;
        }

        /* internal  */onCloseCommand(arg1: Object): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.close();
            }
            GangFightsOpenIcon.instance.hide();
            if (GangFightsEnterWindow.hasInstance()) 
            {
                GangFightsEnterWindow.instance.hide();
            }
            return;
        }

        /* internal  */onGroupCommand(arg1: SGangFightsGroup): void
        {
            this.groupView.updateByPlayerArray(arg1.members);
            this.enemyView.setEnemys(arg1.enemys);
            this.enemyView.show();
            return;
        }

        /* internal  */onInvitePlayerCommand(arg1: SGangFightsInvitePlayer): void
        {
            GangFightsInviteTeamIcon.instance.showIcon(arg1);
            UiHintIconView.instance.addHintIcon(GangFightsInviteTeamIcon.instance);
            return;
        }

        /* internal  */onPlayerNotOnLine(arg1: SEntityId): void
        {
            if (this.removeRequestEntityId(arg1) && GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.setPlayerNotOnline(arg1);
            }
            return;
        }

        public onMatchCommand(arg1: SGangFightsMatch): void
        {
            var loc1=null;
            if (!Global.isActivate) 
            {
                this.stopBrowserTitleFlink();
                this.setBrowserTitleFlink();
                this.clearTimer = flash.utils.setTimeout(this.stopBrowserTitleFlink, 10000);
            }
            Alert.mode = Alert.Mode_NoneNotModal;
            Alert.alertWinRenderer = TimerAlertWin;
            Alert.buttonWidth = 70;
            Alert.timerOut = Math.ceil(arg1.leftEnterTime * 2 / 3);
            Alert.okLabel = Language.getString(42203);
            loc1 = Language.getString(42205);
            this._alertSp = Alert.show(loc1, null, Alert.OK, null, this.onClose);
            GangFightsReadyTimeView.instance.updateLeftTime(arg1.leftEnterTime);
            GangFightsWaitingTimeView.instance.hide();
            return;
        }

        /* internal  */removeRequestEntityId(arg1: SEntityId): Boolean
        {
            var loc2=null;
            var loc1=0;
            while (loc1 < this._aryRequestPlayerMsg.length) 
            {
                loc2 = this._aryRequestPlayerMsg[loc1] as SEntityId;
                if (EntityUtil.equal(arg1, loc2)) 
                {
                    this._aryRequestPlayerMsg.splice(loc1, 1);
                    return true;
                }
                ++loc1;
            }
            return false;
        }

        /* internal  */get leaveBtnView(): CopyLeaveBtnView
        {
            if (!this._leaveBtnView) 
            {
                this._leaveBtnView = new CopyLeaveBtnView(this.isLeave);
            }
            return this._leaveBtnView;
        }

        /* internal  */get gangFightsLeftTimeView(): LeftTimeView
        {
            if (!this._gangFightsLeftTimeView) 
            {
                this._gangFightsLeftTimeView = new LeftTimeView(Language.getString(42208));
            }
            return this._gangFightsLeftTimeView;
        }

        public get groupView(): ArenaGroupView
        {
            if (!this._groupView) 
            {
                this._groupView = new ArenaGroupView();
            }
            return this._groupView;
        }

        public get enemyView(): GangFightsAids
        {
            if (!this._enemyView) 
            {
                this._enemyView = new GangFightsAids();
            }
            return this._enemyView;
        }

        /* internal  */setBrowserTitleFlink(): void
        {
            Global.stage.addEventListener(flash.events.Event.ACTIVATE, this.onStageActivate);
            this.browserTitle = BrowerManager.instance.title;
            this.blinkInterval = flash.utils.setInterval(this.flinkerTitle, 500);
            return;
        }

        /* internal  */flinkerTitle(): void
        {
            if (this.lastTitle != this.matchTitle) 
            {
                this.lastTitle = this.matchTitle;
            }
            else 
            {
                this.lastTitle = this.browserTitle;
            }
            BrowerManager.instance.title = this.lastTitle;
            return;
        }

        /* internal  */stopBrowserTitleFlink(): void
        {
            flash.utils.clearInterval(this.blinkInterval);
            flash.utils.clearTimeout(this.clearTimer);
            if (this.browserTitle) 
            {
                BrowerManager.instance.title = this.browserTitle;
            }
            Global.stage.removeEventListener(flash.events.Event.ACTIVATE, this.onStageActivate);
            return;
        }

        /* internal  */onStageActivate(arg1: Object /* flash.events.Event */): void
        {
            this.stopBrowserTitleFlink();
            return;
        }

        /* internal  */onClose(arg1: int): void
        {
            var loc1=true;
            Dispatcher.dispatchEvent(new DataEvent(EventName.GangFightsIsAccept, loc1));
            return;
        }

        /* internal  */onMyInfoCommand(arg1: SGangFightsMyInfo): void
        {
            if (this._isWaitingRoomRequest) 
            {
                if (arg1.teamId == 0) 
                {
                    this.tipAddTeam();
                }
            }
            this._isWaitingRoomRequest = false;
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateMyInfo(arg1);
            }
            if (GangFightsMeritWindow.hasInstance()) 
            {
                GangFightsMeritWindow.instance.updateInfo(arg1);
            }
            return;
        }

        /* internal  */onMyInfoExCommand(arg1: SGangFightsMyInfoEx): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateMyInfoEx(arg1);
            }
            if (GangFightsMeritWindow.hasInstance()) 
            {
                GangFightsMeritWindow.instance.updateInfoEx(arg1);
            }
            return;
        }

        /* internal  */tipAddTeam(): void
        {
            if (this._isIntip) 
            {
                return;
            }
            var loc1=Language.getString(44554);
            loc1 = loc1 + Language.getString(44555);
            loc1 = loc1 + Language.getString(44556);
            Alert.okLabel = Language.getString(44557);
            Alert.buttonWidth = 70;
            Alert.showCloseBtn = true;
            Alert.show(loc1, null, Alert.OK, null, this.onCloseTipAddTeam);
            this._isIntip = true;
            return;
        }

        /* internal  */onCloseTipAddTeam(arg1: int): void
        {
            if (arg1 == Alert.OK) 
            {
                GangFightsMainWindow.instance.show();
                GangFightsMainWindow.instance.changeToTab(1);
            }
            this._isIntip = false;
            return;
        }

        /* internal  */onOpenCommand(arg1: SGangFightsOpen): void
        {
            if (cache.role.entityInfo.level >= LevelLimitDefin.GangFightsLimitLevel) 
            {
                GangFightsOpenIcon.instance.show();
            }
            return;
        }

        /* internal  */onResultCommand(arg1: SGangFightsResult): void
        {
            GangFightsResultWindow.instance.updateResult(arg1);
            GangFightsResultWindow.instance.show();
            if (GangFightsReadyTimeView.hasInstance()) 
            {
                GangFightsReadyTimeView.instance.hide();
            }
            if (this._gangFightsLeftTimeView) 
            {
                this._gangFightsLeftTimeView.hide();
            }
            if (this._alertSp && this._alertSp.parent && arg1.isBattler) 
            {
                this._alertSp.parent.removeChild(this._alertSp);
            }
            if (GangFightsWaitingTimeView.hasInstance() && arg1.isBattler) 
            {
                GangFightsWaitingTimeView.instance.hide();
            }
            GameController.relive.view.hide();
            if (arg1.isBattler) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaClearCd));
            }
            return;
        }

        /* internal  */onSignUpCommand(arg1: SGangFightsSignUp): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateSignUpState(arg1);
            }
            if (arg1.isCancel) 
            {
                if (GangFightsWaitingTimeView.hasInstance()) 
                {
                    GangFightsWaitingTimeView.instance.stop();
                    GangFightsWaitingTimeView.instance.hide();
                }
            }
            else 
            {
                GangFightsWaitingTimeView.instance.show();
                GangFightsWaitingTimeView.instance.reset();
                GangFightsWaitingTimeView.instance.start();
            }
            return;
        }

        /* internal  */onStartCommand(arg1: SGangFightsStart): void
        {
            MsgManager.showTaskTarget(Language.getString(42202));
            GangFightsReadyTimeView.instance.hide();
            this.gangFightsLeftTimeView.show();
            this.gangFightsLeftTimeView.updateLeftTime(arg1.time);
            return;
        }

        /* internal  */onTeamInfoCommand(arg1: SGangFightsTeamInfo): void
        {
            if (cache.gangFights.myInfo && cache.gangFights.myInfo.teamId == arg1.teamId) 
            {
                cache.gangFights.myTeamInfo = arg1;
                GangFightsMainWindow.instance.updateTeamInfo(arg1);
            }
            if (this._isRequestOtherData) 
            {
                GangFightsTeamMsgWindow.instance.show();
                GangFightsTeamMsgWindow.instance.updateTeamInfo(arg1);
                this._isRequestOtherData = false;
            }
            return;
        }

        /* internal  */onTopListCommand(arg1: SGangFightsToplist): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateTopList(arg1);
            }
            return;
        }

        /* internal  */onWillOpenCommand(arg1: Object): void
        {
            return;
        }

        /* internal  */onMagicStoneCommand(arg1: int): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateMoeny();
            }
            return;
        }

        /* internal  */onMeritCommand(arg1: int): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateMoeny();
            }
            return;
        }

        /* internal  */onAccountCommand(arg1: SGangFightsAccount): void
        {
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.updateAccount();
            }
            if (GangFightsMeritWindow.hasInstance()) 
            {
                GangFightsMeritWindow.instance.updateAccount(arg1);
            }
            return;
        }

        /* internal  */onPlayerInfoCommand(arg1: SLookupPlayerReply): void
        {
            if (this.removeRequestEntityId(arg1.miniPlayer.entityId) && GangFightsMainWindow.instance) 
            {
                GangFightsMainWindow.instance.updateTeamPlayerInfo(arg1);
            }
            return;
        }

        /* internal  */onRoleLevelUpdate(arg1: int): void
        {
            if (cache.gangFights.isOpen && cache.role.entityInfo.level >= LevelLimitDefin.GangFightsLimitLevel) 
            {
                GangFightsOpenIcon.instance.show();
            }
            return;
        }

        /* internal  */onCreateTeamSuccess(arg1: Object): void
        {
            if (GangFightsCreateTeamWindow.hasInstance()) 
            {
                GangFightsCreateTeamWindow.instance.hide();
            }
            return;
        }

        /* internal  */onModifyTeamSuccess(arg1: Object): void
        {
            if (GangFightsCreateTeamWindow.hasInstance()) 
            {
                GangFightsCreateTeamWindow.instance.hide();
            }
            return;
        }

        /* internal  */onGangFightsDieCommand(arg1: SEntityId): void
        {
            if (this._enemyView) 
            {
                this.enemyView.setDead(arg1);
            }
            return;
        }

        /* internal  */onGetRoomList(arg1: DataEvent): void
        {
            GameProxy.gangFights.getGangFightsRooms();
            return;
        }

        /* internal  */onShowGangFightsEnterWindow(arg1: DataEvent): void
        {
            GangFightsEnterWindow.instance.show();
            return;
        }

        /* internal  */onRequestEnterWaitingRoom(arg1: DataEvent): void
        {
            GameProxy.gangFights.enterGangFights(true, arg1.data as int);
            return;
        }

        /* internal  */onShowMainWindow(arg1: DataEvent): void
        {
            GangFightsMainWindow.instance.show();
            return;
        }

        /* internal  */onGetMyInfo(arg1: DataEvent=null): void
        {
            GameProxy.gangFights.getMyInfo();
            return;
        }

        /* internal  */onGetBattles(arg1: DataEvent): void
        {
            GameProxy.gangFights.getBattles();
            return;
        }

        /* internal  */onGangFightsLookBattle(arg1: DataEvent): void
        {
            GameProxy.gangFights.enterGangFights(false, 0, int(arg1.data));
            return;
        }

        /* internal  */onGangFightsJoin(arg1: DataEvent): void
        {
            GameProxy.gangFights.signUpGangFights(false);
            return;
        }

        /* internal  */onGangFightsCancelJoin(arg1: DataEvent): void
        {
            GameProxy.gangFights.signUpGangFights(true);
            return;
        }

        /* internal  */onSceneUpdate(arg1: DataEvent): void
        {
            if (GameMapUtil.curMapState.isGangFightsWaitingRoom) 
            {
                if (GangFightsEnterWindow.hasInstance()) 
                {
                    GangFightsEnterWindow.instance.hide();
                }
                this.onGetMyInfo();
                this._isWaitingRoomRequest = true;
            }
            if (GameMapUtil.curMapState.isGangFights) 
            {
                this._isInGangFights = true;
                LayerManager.rightTopUILayer.hide();
                if (GangFightsMainWindow.hasInstance()) 
                {
                    GangFightsMainWindow.instance.hide();
                }
                if (cache.gangFights.isMatch) 
                {
                    GangFightsReadyTimeView.instance.show();
                }
                this.leaveBtnView.show();
                if (GangFightsResultWindow.hasInstance()) 
                {
                    GangFightsResultWindow.instance.hide();
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskShowOrHide, false));
                Dispatcher.dispatchEvent(new DataEvent(EventName.CopyEnterCopyMap));
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowGameMainUI, false));
                Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaClearCd));
            }
            else if (this._isInGangFights) 
            {
                LayerManager.rightTopUILayer.show();
                Dispatcher.dispatchEvent(new DataEvent(EventName.CopyLeaveCopyMap));
                if (this._leaveBtnView) 
                {
                    this._leaveBtnView.hide();
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.Role_Relive_City));
                this._isInGangFights = false;
                if (GangFightsReadyTimeView.hasInstance()) 
                {
                    GangFightsReadyTimeView.instance.hide();
                }
                if (this._groupView) 
                {
                    this._groupView.updateByPlayerArray([]);
                }
                if (this._enemyView) 
                {
                    this.enemyView.hide();
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.ShowGameMainUI, true));
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskShowOrHide, true));
                Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTrackShowOrHide, false));
            }
            return;
        }

        /* internal  */onGangFightExit(arg1: DataEvent): void
        {
            Alert.show(Language.getString(44414), null, Alert.OK | Alert.CANCEL, null, this.onExitGangFight);
            return;
        }

        /* internal  */onGangFightExitNow(arg1: DataEvent): void
        {
            this.exitGangFight();
            return;
        }

        /* internal  */onExitGangFight(arg1: int): void
        {
            if (arg1 == Alert.OK) 
            {
                this.exitGangFight();
            }
            return;
        }

        /* internal  */exitGangFight(): void
        {
            GameProxy.gangFights.enterGangFights(true, 0);
            return;
        }

        /* internal  */isLeave(): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GangFightExit));
            return;
        }

        /* internal  */onGangFightsChangeToTab(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            if (GangFightsMainWindow.hasInstance()) 
            {
                GangFightsMainWindow.instance.changeToTab(loc1);
            }
            return;
        }

        /* internal  */onGangFightsShowCreateTeamWindow(arg1: DataEvent): void
        {
            GangFightsCreateTeamWindow.instance.isModifyMode = false;
            GangFightsCreateTeamWindow.instance.show();
            return;
        }

        /* internal  */onGetTopList(arg1: DataEvent): void
        {
            var loc1=arg1.data as GangFightsGetTopListdata;
            GameProxy.gangFights.getTopList(loc1.page, loc1.pageSize, loc1.orderObjType, loc1.onlyMyServer, loc1.isShowMyPos);
            return;
        }

        /* internal  */onApplyTeam(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            GameProxy.gangFights.applyTeam(loc1);
            return;
        }

        /* internal  */onCreateTeam(arg1: DataEvent): void
        {
            var loc1=arg1.data as GangfightsCreateTeamData;
            GameProxy.gangFights.createTeam(loc1.name, loc1.faceId);
            return;
        }

        /* internal  */onGangFightsReplyApply(arg1: DataEvent): void
        {
            var loc1=arg1.data as GangFightsReplyData;
            GameProxy.gangFights.dealApply(loc1.entityId, loc1.isAgree);
            return;
        }

        /* internal  */onGetTeamInfo(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            GameProxy.gangFights.getTeamInfo(loc1);
            return;
        }

        /* internal  */onGetTeamOtherInfo(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            GameProxy.gangFights.getTeamInfo(loc1);
            this._isRequestOtherData = true;
            return;
        }

        /* internal  */onGangFightsModifyTeam(arg1: DataEvent): void
        {
            var loc1=arg1.data as GangfightsCreateTeamData;
            GameProxy.gangFights.modifyTeam(loc1.name, loc1.faceId);
            return;
        }

        /* internal  */onChangeCaptain(arg1: DataEvent): void
        {
            var loc1=arg1.data as SEntityId;
            GameProxy.gangFights.teamMemberOper(loc1, EGangFightsTeamPos.convert(EGangFightsTeamPos._EGangFightsTeamLeader));
            return;
        }

        /* internal  */onKickOut(arg1: DataEvent): void
        {
            var loc1=arg1.data as SEntityId;
            GameProxy.gangFights.teamMemberOper(loc1, EGangFightsTeamPos.convert(EGangFightsTeamPos._EGangFightsTeamNULL));
            return;
        }

        /* internal  */onDisbandTeam(arg1: DataEvent): void
        {
            GameProxy.gangFights.disbandTeam();
            return;
        }

        /* internal  */onLeaveTeam(arg1: DataEvent): void
        {
            GameProxy.gangFights.teamMemberOper(cache.role.entityInfo.entityId, EGangFightsTeamPos.convert(EGangFightsTeamPos._EGangFightsTeamNULL));
            return;
        }

        /* internal  */onInviteFriend(arg1: DataEvent): void
        {
            GameProxy.gangFights.invitePlayer(arg1.data as SEntityId);
            return;
        }

        /* internal  */onReplyInvite(arg1: DataEvent): void
        {
            var loc1=arg1.data as GangFightsReplyData;
            GameProxy.gangFights.dealInvite(loc1.teamId, loc1.isAgree);
            return;
        }

        private /* const */matchTitle: string=" ";

        private /* var */_isRequestOtherData: Boolean=false;

        private /* var */_isIntip: Boolean=false;

        private /* var */_gangFightsEnterWindow: GangFightsEnterWindow;

        private /* var */_alertSp: Object /* flash.display.Sprite */;

        private /* var */browserTitle: string="";

        private /* var */lastTitle: string="";

        private /* var */blinkInterval: uint=0;

        private /* var */clearTimer: uint=0;

        private /* var */_isWaitingRoomRequest: Boolean=true;

        private /* var */_gangFightsLeftTimeView: LeftTimeView;

        private /* var */_aryRequestPlayerMsg: Array<any>;

        private /* var */_groupView: ArenaGroupView;

        private /* var */_isInGangFights: Boolean=false;

        private /* var */_enemyView: GangFightsAids;

        private /* var */_leaveBtnView: CopyLeaveBtnView;
    }
